<%--
  Created by IntelliJ IDEA.
  User: 83536
  Date: 2018/3/15
  Time: 17:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <title>Title</title>
    <%@include file="/WEB-INF/jsp/comm/head.jsp"%>
</head>
<body>
<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            条件查询
        </div>
        <div class="panel-body">
            <form class="form-inline">
                <div class="form-group">
                    <label>消缺任务编号：</label>
                    <input type="text" name="soleTaskCode" class="form-control"/>
                </div>
                <div class="form-group">
                    <label>任务状态名称：</label>
                    <input type="text" name="taskStatusName" class="form-control"/>
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-danger" onclick="search()"><i class="glyphicon glyphicon-search"></i> 查询</button>
                </div>
            </form>
        </div>
    </div>
    <table id="solveTb"
           data-toggle="table"
           data-url="${ctx}/skm/skm/ssskmShow"
           data-striped="true"
           data-pagination="true"
           data-side-pagination="server"
           data-page-size="4"
           data-page-list="[4,8,12,16]"
           data-query-params="queryParams"
           data-toolbar="toolbar"
            >
        <thead>
        <tr>
            <th data-field="solveTaskCode">任务编号</th>
            <th data-field="solveTaskName">任务名称</th>
            <th data-field="workDocTypename">工作单据</th>
            <th data-field="issuedByname">下发人</th>
            <th data-field="finishTime">下发时间</th>
            <th data-field="taskStatusName"  data-formatter="taskFor">任务状态</th>
            <th data-field="finishTime">任务完成时间</th>
            <th  data-events="events" data-formatter="fmtOpt">操作</th>
        </tr>
        </thead>
    </table>
    <div id="getIdShow">
        <form action="" class="form-horizontal">
            <div class="form-group">
                <div class="col-md-6">
                    <div class="col-md-10">
                        <input type="hidden" name="id" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">消缺任务编号:</label>
                        <div class="col-md-8">
                            <input type="text" name="solveTaskCode" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作单据ID:</label>
                        <div class="col-md-8">
                            <input type="text" name="workDocType" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作单据NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="workDocTypename" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务描述:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskDesc" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务负责人CODE:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskManagerCode" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务负责人NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskManagerName" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务状态ID:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskStatus" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务状态名称:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskStatusName" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务完成时间:</label>
                        <div class="col-md-8">
                            <input type="text" name="finishTime" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">创建日期备注:</label>
                        <div class="col-md-8">
                            <input type="text" name="common" style="border: none" readonly="readonly">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">负责人审查意见:</label>
                        <div class="col-md-8">
                            <input type="text" name="managerSuggestion" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">完成情况描述:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskFinishDesc" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作终结报告:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskFinishReport" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作间断延期记载:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskNotes" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人CODE:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedBycode" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedByname" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务下发时间:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedTime" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人审查意见:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedSuggestion" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">是否取消:</label>
                        <div class="col-md-8">
                            <input type="text" name="isCancel" style="border: none" readonly="readonly">
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div id="update">
        <form class="form-horizontal" method="post">
            <div class="form-group">
                <div class="col-md-6">
                    <div class="col-md-10">
                        <input type="hidden" name="id" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">消缺任务编号:</label>
                        <div class="col-md-8">
                            <input type="text" name="solveTaskCode"style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">消缺任务名称:</label>
                        <div class="col-md-8">
                            <input type="text" name="solveTaskName"style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作单据ID:</label>
                        <div class="col-md-8">
                            <input type="text" name="workDocType"style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作单据NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="workDocTypename" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务描述:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskDesc" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务负责人CODE:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskManagerCode" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务负责人NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskManagerName" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务状态ID:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskStatus" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务状态名称:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskStatusName" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务完成时间:</label>
                        <div class="col-md-8">
                            <input type="text" name="finishTime" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">创建日期备注:</label>
                        <div class="col-md-8">
                            <input type="text" name="common" style="border: none"readonly="readonly">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">负责人审查意见:</label>
                        <div class="col-md-8">
                            <input type="text" name="managerSuggestion" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">完成情况描述:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskFinishDesc" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作终结报告:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskFinishReport" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">工作间断延期记载:</label>
                        <div class="col-md-8">
                            <input type="text" name="taskNotes" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人CODE:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedBycode" style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人NAME:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedByname"style="border: none" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">任务下发时间:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedTime" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">下发人审查意见:</label>
                        <div class="col-md-8">
                            <input type="text" name="issuedSuggestion" style="border: none"readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-md-4 control-label">是否取消:</label>
                        <div class="col-md-8">
                            <select name="isCancel">
                                <option value="0">否</option>
                                <option value="1">是</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<%@include file="/WEB-INF/jsp/comm/foot.jsp"%>
<script src="/static/myjs/solvetaskmainThree.js"></script>
<script>
    function taskFor(value,row) {
        if (value == "待分配") {
            return "<span style='color: orange'>待分配</span>"
        } else if (value == "已分配") {
            return "<span style='color: blue'>已分配</span>"
        } else if (value == "执行中") {
            return "<span style='color: purple'>执行中</span>"
        }
        else {
            return "<span style='color: green'>已完成</span>"
        }
    }
    function fmtOpt(value,row){
        if(row["taskStatusName"]=="已分配"){
            var getShow = `<button class="btn btn-info btn-sm getShow">查看</button>`;
            var update = `      <button class="btn btn-danger btn-sm update">回执录入</button>`;
            var updatez = `      <button class="btn btn-danger btn-sm updatez">执行</button>`;
            var updatex= `      <button class="btn btn-danger btn-sm updatex">修改</button>`;
        }else if(row["taskStatusName"]=="执行中"){
            var getShow = `<button class="btn btn-info btn-sm getShow">查看</button>`;
            var updatez = `      <button class="btn btn-danger btn-sm updatez" disabled="disabled">执行</button>`;
            var update = `      <button class="btn btn-danger btn-sm update">回执录入</button>`;
            var updatex= `      <button class="btn btn-danger btn-sm updatex">修改</button>`;
        }else if(row["taskStatusName"]=="已完成"){
            var getShow = `<button class="btn btn-info btn-sm getShow">查看</button>`;
            var update = `      <button class="btn btn-danger btn-sm update" disabled="disabled">回执录入</button>`;
            var updatez = `      <button class="btn btn-danger btn-sm updatez" disabled="disabled">执行</button>`;
            var updatex= `      <button class="btn btn-danger btn-sm updatex" disabled="disabled">修改</button>`;
        }else if(row["taskStatusName"]=="驳回"){
            var getShow = `<button class="btn btn-info btn-sm getShow">查看</button>`;
            var update = `      <button class="btn btn-danger btn-sm update" disabled="disabled">回执录入</button>`;
            var updatex= `      <button class="btn btn-danger btn-sm updatex" disabled="disabled">修改</button>`;
            var updatez = `      <button class="btn btn-danger btn-sm updatez">执行</button>`;
        }else{
            var getShow = `<button class="btn btn-info btn-sm getShow">查看</button>`;
            var update = `      <button class="btn btn-danger btn-sm update">回执录入</button>`;
            var updatez = `      <button class="btn btn-danger btn-sm updatez">执行</button>`;
            var updatex= `      <button class="btn btn-danger btn-sm updatex">修改</button>`;
        }
        return getShow+update+updatez+updatex;
    }
    function getShow(row){
        for(var prop in row){
            if(prop == 'isCancel'){
                var a = row[prop] == 1 ? '是' : '否';
                $("#getIdShow").find("[name="+prop+"]").val(a);
                continue;
            }
            $("#getIdShow").find("[name="+prop+"]").val(row[prop]);
        }
        $("#getIdShow").dialog("open");
    }
    var events = {
        "click .getShow":function(e,value,row){
            getShow(row);
        },
        "click .update":function(e,value,row){
            update(row);
        },
        "click .updatez":function(e,value,row){
            updatez(row);
        },
        "click .updatex":function(e,value,row){
            updatex(row);
        }
    }
    $(function(){
        $("#getIdShow").dialog({title:'详情',size:'modal-lg'});
    })

    function update(row) {
        for(var prop in row){
            $("#update").find("[name="+prop+"]").val(row[prop]);
        }
        $("#update").dialog("open");
    };
    function updatex(row){
        if(row["taskFinishDesc"]==""||row["taskNotes"]==""||row["taskFinishReport"]==""){
            toastr.warning("回执录入中描述信息为空,不得修改");
        }else{
            $("#update").dialog({
                title:"修改用户",
                btnName:"确定",
                size:'modal-lg',
                btnBind:function(){
                    var param=$("#update form").serialize()
                    $.post(ctx+"skm/skm/update",param,function(msg){
                        toastr.warning("信息提示",msg);
                        $("#update").dialog("close");
                        $("#solveTb").bootstrapTable("refresh");
                    },'text');
                }
            });
                for(var prop in row){
                    $("#update").find("[name="+prop+"]").val(row[prop]);
                }
                $("#update").dialog("open");

        }
    }
    $(function(){
        $("#update").dialog({
            title:"修改用户",
            btnName:"确定",
            size:'modal-lg',
            btnBind:function(){
                var param=$("#update form").serialize();
                $.post(ctx+"skm/skm/update",param,function(msg){
                    toastr.warning("信息提示",msg);
                    $("#update").dialog("close");
                    $("#solveTb").bootstrapTable("refresh");
                },'text');
            }
        });
    });
    function updatez(row){
        $.post(ctx+"skm/skm/updatet",{id:row["id"]},function (msg) {
            toastr.warning(msg);
            $("#solveTb").bootstrapTable("refresh");
        },'text')
    }
</script>
</body>
</html>
